<template>
	<div id="login_new">
		<div class="fill_word">
			<p>
				评论内容
			</p>
			<div class="phone">
				<div class="am-form-group">
					<input type="text" v-model="fd.comment" placeholder="请输入评论内容" />
				</div>
			</div>
			<div class="clear"></div>
		</div>
		<input type="submit" @click="submit()" class="yes" value="评论"></input>
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				usr: '',
				active: {},
				fd: {
					comment: "",
					vid: ''
				}
			}
		},
		onLoad(option) {
			if (option.id) {
				this.fd.vid = option.id;
			}
			var that = this;
			uni.request({
				url: `${config.baseUrl}/active/one?token=` + uni.getStorageSync('token') + '&id=' + that.vid,
				method: 'GET',
				success(r) {
					if (r.data.succ) {
						that.active = r.data.data;
					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			});
		},
		methods: {
			itemClicked: function(item) {
				uni.navigateTo({
					url: 'activity_detail?id=' + this.fd.vid
				})
			},
			submit: function() {
				uni.request({
					url: `${config.baseUrl}/comment/res?token=` + uni.getStorageSync('token'),
					method: 'POST',
					data: this.fd,
					success(r) {
						if (r.data.succ) {
							that.articles = r.data.data;
						}
					},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
				});
			},
		}
	}
</script>

<style>
</style>
